﻿<UserControl x:Class="Sentinel.Highlighters.Gui.HighlightersControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:wpf="clr-namespace:Sentinel.Support.Wpf"
             xmlns:wpfConverters="clr-namespace:WpfExtras.Converters;assembly=WpfExtras">

    <UserControl.Resources>
        <wpfConverters:ColourConverter x:Key="ColorConverter" />
    </UserControl.Resources>
    
    <DockPanel>
        <StackPanel DockPanel.Dock="Left"
                    VerticalAlignment="Center">
            <StackPanel>
                <Button Content="Up"
                        Command="{Binding Highlighters.OrderEarlier}"
                        Margin="5" />
                <Button Content="Down"
                        Command="{Binding Highlighters.OrderLater}"
                        Margin="5" />
            </StackPanel>
        </StackPanel>
        <StackPanel DockPanel.Dock="Right"
                    Width="80">
            <Button Content="_Add"
                    Command="{Binding Highlighters.Add}"
                    Margin="5,0,5,5" />
            <Button Content="_Edit"
                    Command="{Binding Highlighters.Edit}"
                    Margin="5,0,5,5" />
            <Button Content="_Remove"
                    Command="{Binding Highlighters.Remove}"
                    Margin="5,0,5,5" />
        </StackPanel>
        <ListView Margin="5,0,5,0"
                  ItemsSource="{Binding Highlighters.Highlighters}"
                  SelectedIndex="{Binding Highlighters.SelectedIndex}"
                  SelectionMode="Single">
            <ListView.View>
                <GridView>
                    <wpf:FixedWidthColumn FixedWidth="28">
                        <wpf:FixedWidthColumn.HeaderTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="True"
                                          IsEnabled="False"
                                          ToolTipService.ShowOnDisabled="True"
                                          ToolTip="Is the ConcreteHighlighter enabled?" />
                            </DataTemplate>
                        </wpf:FixedWidthColumn.HeaderTemplate>
                        <wpf:FixedWidthColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding Enabled}"
                                          Margin="2,3,0,3" />
                            </DataTemplate>
                        </wpf:FixedWidthColumn.CellTemplate>
                    </wpf:FixedWidthColumn>
                    <GridViewColumn Header="Name"
                                    DisplayMemberBinding="{Binding Name}" />
                    <GridViewColumn Header="Type"
                                    DisplayMemberBinding="{Binding HighlighterType}" />
                    <GridViewColumn Header="Mode"
                                    DisplayMemberBinding="{Binding Mode}" />
                    <GridViewColumn Header="Pattern"
                                    DisplayMemberBinding="{Binding Pattern}" />
                    <wpf:FixedWidthColumn Header="Example"
                                               FixedWidth="100">
                        <wpf:FixedWidthColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock x:Name="example"
                                           Text="Example text...."
                                           Foreground="{Binding Style.Foreground, Converter={StaticResource ColorConverter}, ConverterParameter=WindowText}"
                                           Background="{Binding Style.Background, Converter={StaticResource ColorConverter}, ConverterParameter=Window}"
                                           VerticalAlignment="Stretch"
                                           HorizontalAlignment="Stretch" />
                            </DataTemplate>
                        </wpf:FixedWidthColumn.CellTemplate>
                    </wpf:FixedWidthColumn>
                </GridView>
            </ListView.View>
        </ListView>
    </DockPanel>
</UserControl>



